# Maintainer: Bruno Pagani <archange@archlinux.org>

_pkg=geopandas
pkgname=python-${_pkg}
pkgver=0.14.0
pkgrel=1
pkgdesc="Python tools for geographic data"
arch=(any)
url="https://geopandas.org"
license=(BSD)
depends=(
    gdal
    python-fiona
    python-numpy
    python-packaging
    python-pandas
    python-pyproj
    python-shapely
)
optdepends=(
    'python-pygeos: alternative backend'
    'python-pyogrio: vectorized IO for GDAL/OGR'
    'python-rtree: spatial access methods'
    'python-psycopg2: PostGIS access'
    'python-sqlalchemy: other geodatabase access'
    'python-geopy: geocoding'
    'python-matplotlib: plotting'
#    'python-mapclassify: plotting'
)
makedepends=(python-setuptools)
checkdepends=(
    python-pytest
    python-fsspec
    python-pygeos
    python-pyogrio
    python-rtree
    python-matplotlib
    #python-mapclassify
    #python-folium
    #python-xyzservices
    python-scipy
    python-geopy
    python-sqlalchemy
    python-psycopg2
    libspatialite
    #python-geoalchemy2
    python-pyarrow
    postgis
    ghostscript
)
# No tests data in Pypi
#source=(https://files.pythonhosted.org/packages/source/${_pkg::1}/${_pkg}/${_pkg}-${pkgver}.tar.gz)
source=(https://github.com/geopandas/geopandas/archive/refs/tags/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('1bc5a727d4a8453645c05b7fcdf1f7aaa3d2ef655d9d18642a1adef880880e44')

build() {
  cd ${_pkg}-${pkgver}
  python setup.py build
}

check() {
  cd ${_pkg}-${pkgver}
# failures due to pygeos https://github.com/geopandas/geopandas/pull/2689
  PYTHONPATH="${PWD}"/build/lib/ pytest -vv --color=yes -k 'not test_fillna_scalar and not test_repr_linearring'
}

package() {
  cd ${_pkg}-${pkgver}
  python setup.py install --prefix=/usr --root="${pkgdir}" --skip-build --optimize=1
  install -Dm644 LICENSE.txt -t "${pkgdir}"/usr/share/licenses/${pkgname}
}
